﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BusinessLogicLayer;

namespace logicunivesityinventorystore.Store
{
    public enum UIMODE
    {
        NEW,
        EDIT,
        VIEW
    }
    public partial class AddItems : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

           //s btnOkay.Attributes.Add("onClick", "okay();");
          //  btnOkay.Attributes.Add("onClick", "okay();");
            if (!IsPostBack)
            {
                
                ddlCategory.DataSource = new ItemFacade().FindAllCategory();
                ddlCategory.DataTextField = "CategoryName";
                ddlCategory.DataValueField = "CategoryID";
                ddlCategory.DataBind();
                MultiViewExpanse.ActiveViewIndex = 0;
            }
        }
        private void LoadExpanse()
        {

        }

        protected void lnkAddAnother_Click(object sender, EventArgs e)
        {
        }

        protected void btnOkay_Click(object sender, EventArgs e)
        {
                     

                foreach (GridViewRow row in gvItemList.Rows)
                {
                    CheckBox chk = (CheckBox)row.FindControl("chkItemSelect");
                    Label lbl = (Label)row.FindControl("lblItemCode");
                    Label lb2 = (Label)row.FindControl("lblItemDescription");
                    if (chk.Checked)
                    {
                        System.Collections.ArrayList arrl = (System.Collections.ArrayList)Session["selected"];
                        arrl.Add(lbl.Text);
                        Session["selected"] = arrl;
                        System.Collections.ArrayList arr2 = (System.Collections.ArrayList)Session["SelectedItems"];
                        arr2.Add(lb2.Text);
                        Session["SelectedItems"] = arr2;

                    }
            }
                Page.ClientScript.RegisterStartupScript(this.GetType(), "Call my function", "okay()", true);
              
                   }

        private void UpdateExpanse()
        {


        }

        private void AddExpanse()
        {

        }
    }
}